<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%
	String path = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link href="<%=path%>/css/default.css" rel="stylesheet" type="text/css" />
<script src="<%=path%>/easyui/jquery-1.4.4.min.js"></script>
<script src="<%=path%>/myjs/swfupload/swfupload.js"></script>
<script src="<%=path%>/myjs/swfupload/fileprogress.js"></script>
<script src="<%=path%>/myjs/swfupload/handlers.js"></script>
<script src="<%=path%>/myjs/swfupload/swfupload.queue.js"></script>
<script>

$(function(){
	var upload; 
	upload = new SWFUpload({  
		  
		// 处理文件上传的url  
		upload_url: "<%=path%>/SwfUploadServlet?upload=1",      
		// 上传文件限制设置  
		file_size_limit : "10240",  // 10MB  
		file_types : "*.jpg;*.gif;*.png",   //此处也可以修改成你想限制的类型，比如：*.doc;*.wpd;*.pdf  
		file_types_description : "Image Files",  
		file_upload_limit : "0",  
		//file_queue_limit : "1",  
		// 事件处理设置（所有的自定义处理方法都在handler.js文件里）  
		//file_dialog_start_handler : fileDialogStart,  
		file_queued_handler : fileQueued,  
		file_queue_error_handler : fileQueueError,  
		file_dialog_complete_handler : fileDialogComplete,  
		upload_start_handler : uploadStart,  
		upload_progress_handler : uploadProgress,  
		upload_error_handler : uploadError,  
		upload_success_handler : uploadSuccess,  
		upload_complete_handler : uploadComplete,  
		// 按钮设置  
		button_image_url : "XPButtonUploadText_61x22.png",    // 按钮图标  
		button_placeholder_id : "spanButtonPlaceholder",  
		button_width: 61,  
		button_height: 22,  
		// swf设置  
		flash_url : "swfupload/swfupload.swf",  
		custom_settings : {  
		    progressTarget : "fsUploadProgress",  
		    cancelButtonId : "btnCancel"  
		},  
		    // Debug 设置  
		    debug: false  
		});  
});
</script>
</head>
<body>
<div id="header">
	<h1 id="logo">SWFUpload-Test</h1>
	<div id="version">v2.2.0</div>
</div>

<div id="content">
	<h2>单文件上传例子</h2>
	<form id="form1" action="" method="post" enctype="multipart/form-data">
		<p>只能选择一个文件进行上传.</p>

			<div class="flash" id="fsUploadProgress"></div>  
			<div style="padding-left: 5px;">  
			     <span id="spanButtonPlaceholder"></span>  
			     <input id="btnCancel" type="button" value="取消" onclick="cancelQueue(upload);"   
			disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" />  
			</div>  

	</form>
</div>

</body>
</html>